<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('shop/layout/headerMenu'); ?>
        </div>
    </div>
</div>
</div>

<?php
$form = $this->form;
$form->prepare();
$form->setAttributes(['class' => 'form-horizontal']);
?>

<div class="container">
    <div class="xm-plain-box">
        <div class="box-hd">
            <h3 class="title"><?php echo $this->translate('忘记密码'); ?></h3>
        </div>
        <div class="box-bd">
            <div class="row">
                <?php echo $this->partial('shop/message'); ?>

                <?php echo $this->form()->openTag($form); ?>
                <?php echo $this->formElement($form->get('shopCsrf')); ?>
                <?php echo $this->formElementErrors($form->get('shopCsrf'), ['class'=>'error-message']); ?>
                <div class="control-group">
                    <label for="input01" class="control-label"><?php echo $this->translate('重置方式'); ?>：</label>
                    <div class="controls">
                        <?php echo $this->translate('手机号码'); ?>
                        &nbsp;&nbsp;<a href="<?php echo $this->url('shop-user', ['action' => 'userForgetPassword']); ?>" class="btn"><?php echo $this->translate('点击通过电子邮箱重置'); ?></a>
                    </div>
                </div>
                <div class="control-group">
                    <label for="input01" class="control-label"><?php echo $this->translate('手机号码'); ?>：</label>
                    <div class="controls">
                        <?php
                        $form->get('userPhone')->setAttributes([
                            'class' => 'form-control',
                            'placeholder' => $this->translate('联系电话')
                        ]);
                        if(count($this->phoneArea) == 1) { ?>
                            <?php echo $this->formElement($form->get('areaCode')); ?>
                            <?php echo $this->formElementErrors($form->get('areaCode'), ['class'=>'error-message']); ?>
                            <?php echo $this->formElement($form->get('userPhone')); ?>
                            <?php echo $this->formElementErrors($form->get('userPhone'), ['class'=>'error-message']); ?>
                        <?php } else {
                            $form->get('areaCode')->setAttributes([
                                'style' => 'width:150px'
                            ]);
                            ?>
                            <?php echo $this->formElement($form->get('areaCode')); ?>
                            <?php echo $this->formElementErrors($form->get('areaCode'), ['class'=>'error-message']); ?>

                            <?php echo $this->formElement($form->get('userPhone')); ?>
                            <?php echo $this->formElementErrors($form->get('userPhone'), ['class'=>'error-message']); ?>
                        <?php } ?>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <button class="btn btn-primary" type="submit"><?php echo $this->translate('下一步'); ?></button>
                    </div>
                </div>
                <?php echo $this->form()->closeTag(); ?>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                userName: {
                    required: true
                },
                userEmail: {
                    required: true,
                    email: true
                }
            },
            messages: {
                userName: {
                    required: "<?php echo $this->translate('请输入会员名称!'); ?>"
                },
                userEmail: {
                    required: "<?php echo $this->translate('请输入会员邮箱!'); ?>",
                    email: "<?php echo $this->translate('电子邮箱格式错误!'); ?>"
                }
            }
        });
    });
</script>